package com.longcai.service.fuyoupay.impl;

import java.util.Date;
import java.util.UUID;

import org.springframework.stereotype.Service;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.longcai.entity.payment.fuyou.request.ClyjFuyouWithdraw;
import com.longcai.fenzhuang.fuyou.BaseResponse;
import com.longcai.fenzhuang.fuyou.FuyouCommonPortMethod;
import com.longcai.mapper.fuyoupay.ClyjFuyouWithdrawMapper;
import com.longcai.service.fuyoupay.ClyjFuyouWithdrawService;

/**
 * <p>
 *  提現
 * </p>
 *
 * @author LWK
 * @since 2019-04-16
 */
@Service
public class ClyjFuyouWithdrawServiceImpl extends ServiceImpl<ClyjFuyouWithdrawMapper, ClyjFuyouWithdraw> implements ClyjFuyouWithdrawService {
	@Override
	public ClyjFuyouWithdraw checkout(JSONObject params) {
		ClyjFuyouWithdraw cfwd=new ClyjFuyouWithdraw();
		cfwd.setId(UUID.randomUUID().toString().replace("-", ""));
		cfwd.setLoginId(params.getString("loginId"));//待定
		cfwd.setAmt(params.getString("amt"));
		cfwd.setChannel(params.getString("channel"));
		cfwd.setPageNotifyUrl("");
		cfwd.setBackoNtifyUrl("");
		cfwd.setTime(new Date());
		FuyouCommonPortMethod  fuyouCommonPortMethod=new FuyouCommonPortMethod();
		BaseResponse r = fuyouCommonPortMethod.withdraw(cfwd);
		if (r!=null&r.getRespCode().equals("0000")) {
			return cfwd;
		}
		return null;
	}

}
